﻿using System;

namespace CPN.PJN.Silverlight.Extensions.Validation
{
    public class CustomValidator<T> : ValidatorBase<T>
    {
        Func<T, bool> validationMethod;

        public CustomValidator(Func<T, bool> validate)
        {
            this.validationMethod = validate;
            this.DefaultMessage = "Valeur incorrecte !";
        }

        public override bool Validate(T value)
        {
            return validationMethod(value);
        }
    }
}
